QuickTime 3 Reference

Previous | Chapter Top | Chapter Contents | Next

Music Component Functions: Miscellaneous

Use the functions described in this section to get and modify the master tuning of the synthesizer, to play off-line, and to allow the music component to perform tasks it must perform at foreground task time.

MusicGetMasterTune

The MusicGetMasterTune function returns a fixed-point value in semitones, which is the synthesizer's master tuning.

pascal ComponentResult MusicGetMasterTune (MusicComponent mc);
mc
Music component instance identifier returned by NAGetRegisteredMusicDevice .
function result
The function returns a positive value representing the synthesizer's master tuning or a negative result code.

MusicSetMasterTune

The MusicSetMasterTune function alters the synthesizer's master tuning.

pascal ComponentResult MusicSetMasterTune(
                     MusicComponent mc,
                     long masterTune);
mc
Music component instance identifier returned by NAGetRegisteredMusicDevice .
masterTune
The amount by which to transpose the entire synthesizer in pitch. The value is a fixed 16.16 number that allows shifts by fractional values.
function result
A result code.

MusicStartOffline

The MusicStartOffline function informs the QuickTime music synthesizer that the music will not be played through the speakers. Instead, audio data will be sent to a function that will create a sound file to be played back later.

extern pascal ComponentResult MusicStartOffline(
                     MusicComponent mc,
                     unsigned long *numChannels,
                     UnsignedFixed *sampleRate,
                     unsigned short *sampleSize,
                     MusicOfflineDataUPP dataProc,
                     long dataProcRefCon)
mc
Music component instance identifier returned by NAGetRegisteredMusicDevice .
numChannels
Number of channels in the music sample. 1 indicates monaural; 2 indicates stereo.
sampleRate
The number of samples per second.
sampleSize
The size of the music sample: 8-bit or 16-bit.
dataProc
A function to handle the audio data.
dataProcRefCon
A reference constant to pass to the dataProc function.
function result
A result code.

DISCUSSION

You pass the MusicStartOffline function the requested values for the numChannels , sampleRate , and sampleSize parameters. When the function returns, those parameters contain the actual values used.

MusicSetOfflineTimeTo

The MusicSetOfflineTimeTo function advances the synthesizer clock when the synthesizer is not running in real time (due to a call to MusicStartOffline).

extern pascal ComponentResult MusicSetOfflineTimeTo(
                     MusicComponent mc,
                     long newTimeStamp)
mc
Music component instance identifier returned by NAGetRegisteredMusicDevice .
newTimeStamp
The number of samples to synthesize.
function result
A result code.

DISCUSSION

Setting the time generates audio output from the synthesizer.

MusicTask

Call the MusicTask function periodically to allow a music component to perform tasks it must perform at foreground task time.

extern pascal ComponentResult MusicTask (MusicComponent mc)
mc
Music component instance identifier returned by NAGetRegisteredMusicDevice .
function result
A result code.

DISCUSSION

In the case of the QuickTime music synthesizer, instruments cannot be loaded from disk at interrupt time, so if the NASetInstrumentNumberInterruptSafe function is called, the instrument is loaded during the next MusicTask call.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next